#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <Foundation/NSXMLParser.h>

@class FWApplication;
@class LIPlugin;

@protocol FWMapViewSettingsDelegate
@property (assign) NSInteger mapViewType;
@end


#ifdef DEVELOPMENT_MODE
@interface FWMapView : UIView <MKAnnotation, MKMapViewDelegate, NSXMLParserDelegate>
#else
@interface FWMapView : UIView <MKAnnotation, MKMapViewDelegate>
#endif
{
    id<FWMapViewSettingsDelegate> settings;

    UISegmentedControl* mapTypeBtns;
    UIBarButtonItem* locationBtn;
    MKMapView* mapView;
    NSURLConnection* addressLookup;
    
    NSMutableData* lookupResponse;
    
    BOOL hasLocationServices;
    BOOL hasShownLocationMessage;
    BOOL showingLocation;
    BOOL shownLocation;
    BOOL showPopups;
    
    // For lookup operations
    BOOL waitingForLocation;
    BOOL waitingForLocale;
    BOOL waitingForAnnotations;
    
    NSString* title;
    NSString* location;

    NSMutableString* parsedXPath;
    NSMutableString* parsedValue;
    NSString* parsedStatus;
    NSString* parsedAddress;
    NSString* parsedLatitude;
    NSString* parsedLongitude;
}

@property (retain) LIPlugin* plugin;
@property (retain) UISegmentedControl* mapTypeBtns;
@property (retain) UIBarButtonItem* locationBtn;
@property (retain) MKMapView* mapView;
@property (retain) NSURLConnection* addressLookup;
@property (retain) NSMutableData* lookupResponse;
@property (retain) id<MKAnnotation> selectedAnnotation;
@property (retain) NSString* title;
@property (retain) NSString* location;

@property (retain) NSMutableString* parsedXPath;
@property (retain) NSMutableString* parsedValue;
@property (retain) NSString* parsedStatus;
@property (retain) NSString* parsedAddress;
@property (retain) NSString* parsedLatitude;
@property (retain) NSString* parsedLongitude;


- (id)initWithFrame:(CGRect)rect config:(id<FWMapViewSettingsDelegate>)config plugin:(LIPlugin*)plugin showPopups:(BOOL)popups location:(NSString*)location title:(NSString*)title coordinates:(CLLocation*)coordinates;

@end
